/* 角色设置的接口 */
import request from '@/utils/request'

// 1.获取角色列表
export const reqGetRoleList = (page = 1, pagesize = 6) => {
  return request({
    method: 'get',
    url: '/sys/role',
    params: { page, pagesize },
  })
}

// 2.根据id删除角色
export const reqDelRoleById = id => {
  return request({
    method: 'delete',
    url: `/sys/role/${id}`,
  })
}

// 3.添加角色
export const reqPostAddRole = data => {
  return request({
    method: 'post',
    url: '/sys/role',
    data,
  })
}

// 4.根据ID获取角色详情
export const reqGetRoleById = id => {
  return request.get(`/sys/role/${id}`)
}

// 5.根据ID更新角色
export const reqEditRoleById = (id, data) => {
  return request({
    method: 'put',
    url: `/sys/role/${id}`,
    data,
  })
}

// 6.给角色分配权限
export const reqEditPermIds = data => {
  return request({
    method: 'put',
    url: `/sys/role/assignPrem`,
    data,
  })
}
